package com.aboo.infrastructure.mybatis;


import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/*
 * @description
 * @author Yata.Niko
 * @version 1.0
 * @date 2024/3/30
 */
public interface UserMapper {
    @Insert("INSERT INTO usr_user(user_code, user_name, age) VALUES(#{userCode}, #{userName}, #{age})")
    void createUser(User user);

    @Select("SELECT * FROM usr_user")
    List<User> getAllUsers();

    @Update("UPDATE usr_user SET user_code=#{userCode}, user_name=#{userName}, age=#{age} WHERE id=#{id}")
    void updateUser(User user);

    @Delete("DELETE FROM usr_user WHERE id=#{id}")
    void deleteUser(Integer id);
}
